package com.wln.sms.sms.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.wln.sms.sms.vo.ActivityGoodsVo;
import com.wln.sms.sms.vo.GoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wln.sms.sms.entity.GoodsActivityEntity;
import com.wln.sms.sms.service.GoodsActivityService;
import com.wln.common.utils.PageUtils;
import com.wln.common.utils.R;



/**
 * 
 *
 * @author wulinna
 * @email 2258732595@qq.com
 * @date 2022-02-22 14:30:53
 */
@RestController
@RequestMapping("sms/goodsactivity")
public class GoodsActivityController {
    @Autowired
    private GoodsActivityService goodsActivityService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = goodsActivityService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{activityId}")
    public R info(@PathVariable("activityId") Long activityId){
		ActivityGoodsVo activityGoodsVo = goodsActivityService.showInfo(activityId);

        return R.ok().put("activityGoodsVo", activityGoodsVo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody GoodsActivityEntity goodsActivityEntity){
        goodsActivityService.save(goodsActivityEntity);
        return R.ok();
    }



    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody GoodsActivityEntity goodsActivity){
		goodsActivityService.updateById(goodsActivity);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] activityIds){
		goodsActivityService.removeByIds(Arrays.asList(activityIds));

        return R.ok();
    }

}
